import React from 'react'
import { Redirect } from 'react-router'
import { Home, Carts, Detail, News, LoginContext as Login,App } from './modules'
import fakeAuth from './Auth'

module.exports = [
 
  {
    'path':'/detail',
    'component': Detail
  },

  {
    'path':'/',
    'component': App,
    'exact':true
  },
  {
    'path':'/news',
    'component': News
  },
  {
    'path':'/login',
    'component': Login
  },
  {
    'path':'/carts',
    'component': () => (fakeAuth.isAuthenticated ? (<Carts />) : (<Redirect to={{pathname: '/login',state: { from: '/carts'}
    }}/>))
  }
]